import {customeStruct} from '../utils';
const itf = customeStruct.interface;

export const InitDataStruct = itf({
    payload: itf({
        brands: [itf(Object.assign({
            id: 'string',
            code: 'string',
            name: 'string',
        }))],
        isDealerUser: 'boolean',
    })
});

const content = {
    id: 'string',
    code: 'string',
    subDealerCode: 'string',
    subDealerName: 'string? | null',
    totalQuantity: 'number? | null',
    partOrderTypeName: 'string? | null',
    partOrderPriceTerms: 'number? | null',
    paymentType: 'number? | null',
    status: 'number',
    createTime: 'datetime? | null',
    rowVersion: 'string',
    options: ['string']
};

export const List = itf({
    payload: itf({
        content: [itf(Object.assign(content))]
    })
});

export const Detail = itf({
    payload: itf({
        id: 'string',
        code: 'string',
    })
});

const Department = {
    id: 'string',
    supplierCode: 'string',
    supplierName: 'string',
    shortName: 'string? | null',
    address: 'string? | null',
    contactName: 'string? | null',
    contactPhone: 'string? | null',
    taxRate: 'number? | null',
    settlementType: 'number? | null',
};

export const SupplierList = itf({
    payload: itf({
        content: [itf(Department)]
    })
});

export const SupplierSimpleList = itf({
    payload: itf({
        content: [
            itf({
                id: 'string',
                supplierCode: 'string',
                supplierName: 'string'
            })
        ]
    })
});
export const SelectList = itf({
    payload: itf({
        content: [itf(Object.assign({
            id: 'string',
        }))],
    })
});
const dealer = {
    id: 'string',
    code: 'string',
    name: 'string'
};

export const DealerList = itf({
    payload: itf({
        content: [itf(dealer)]
    })
});

export const DealerSimpleList = itf({
    payload: itf({
        content: [
            itf({
                id: 'string',
                code: 'string',
                name: 'string'
            })
        ]
    })
});

export const HistoryList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
        })],
    })
});

export const HistoryDetail = itf({
    payload: itf({
        id: 'string',
    })
});
